//headers 
#include<algorithm>
#include<cassert>
#include<cstdio>
#include<deque>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<deque>
#include<set>
#include<string>
#include<sstream>
#include<stack>
#include<streambuf>
#include<vector>
using namespace std;

//macros
#define LET(x,a) typeof(a) x(a)
#define FOR(i,a,n) for(LET(i,a);i!=n;i++)
#define REP(i,n) FOR(i,0,n)
#define sz size()
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define dbge(x) cout<<#x<<"->"<<x<<endl;
#define PRINT(x) { REP(_,x.sz) cout<<x[_]<<" "; cout<<endl; }
#define GI ({int _; scanf("%d",&_); _; })
#define VI vector<int>
#define VVI vector< vector<int> >
#define VS vector<string>
#define LL long long
#define INF (int)1e8

//code of suren

VVI grid ;
VI prev ; 
int dp[10]100];


int go( int i , int j){
  int ret = dp[i][j];
  if(ret != 0 ) return ret;
  prev.pb(j);
}


int main(){
  int m , n ;
  while( cin>>m>>n ){
    grid.clear(); grid.resize(m); prev.clear(); prev.resize(n);
    memset(dp,0,sizeof(dp));
    int ans = INF;
    REP(i,m) ans = min(ans,go(i,n-1));
    PRINT(prev); cout<<ans<<endl;
  }
  return 0;
}
